﻿
@model MvcForum.Web.ViewModels.Member.MemberFrontEndEditViewModel

@{
    Layout = "~/Views/Shared/_LayoutFullWidth.cshtml";
    ViewBag.Title = Html.LanguageString("Members.EditProfile");
    var settings = Html.Settings();
}
@section Header
{
    <script type="text/javascript">
        $.ajax({
            url: app_base + 'Badge/ProfileBadgeCheck',
            type: 'POST',
            error: function (xhr, ajaxOptions, thrownError) {
                ShowUserMessage("Error: " + xhr.status + " " + thrownError);
            }
        });
    </script>

}
<div class="row">

    <div class="col-md-6 col-md-offset-3">
        @using (Html.BeginForm("Edit", "Members", FormMethod.Post, new { enctype = "multipart/form-data", @class = "editmemberform" }))
        {
            @Html.HiddenFor(x => Model.Id)

            @Html.ValidationSummary(true)

            <fieldset>
                <legend>@ViewBag.Title</legend>

                <p class="changepasswordtext">
                    @Html.Raw(string.Format(Html.LanguageString("Members.ChangePassword.Link"), string.Format("<a href=\"{0}\">{1}</a>", Url.Action("ChangePassword"), Html.LanguageString("Members.ChangePassword.Title"))))
                </p>

                <div class="form-group">
                    @Html.LabelFor(x => x.UserName)
                    @Html.TextBoxFor(x => x.UserName, new { @class = "form-control" })
                    @Html.ValidationMessageFor(x => x.UserName)
                </div>

                <div class="form-group">
                    @Html.LabelFor(x => x.Email)
                    @Html.TextBoxFor(x => x.Email, new { @class = "form-control", type = "email" })
                    @Html.ValidationMessageFor(x => x.Email)
                </div>

                @if (!Model.DisableFileUploads)
                {
                    <div class="row membereditavatar">
                        <div class="col-md-2">
                            <img src="@AppHelpers.MemberImage(Model.Avatar, Model.Email, Model.Id, SiteConstants.Instance.GravatarProfileSize)" alt="@Model.UserName">
                        </div>
                        <div class="col-md-10">
                            @Html.LabelFor(x => x.Files)
                            <div class="input-group">
                                <span class="input-group-btn">
                                    <span class="btn btn-default btn-file">
                                        @Html.LanguageString("Post.Browse") <input type="file" name="files" id="files" value="">
                                    </span>
                                </span>
                                <input type="text" class="form-control" readonly="">
                            </div>
                            @Html.ValidationMessageFor(x => x.Files)
                        </div>
                    </div>
                }

                <div class="form-group">
                    @Html.LabelFor(x => x.Age)
                    @Html.TextBoxFor(x => x.Age, new { @class = "form-control" })
                    @Html.ValidationMessageFor(x => x.Age)
                </div>

                <div class="form-group">
                    @Html.LabelFor(x => x.Location)
                    @Html.TextBoxFor(x => x.Location, new { @class = "form-control" })
                    @Html.ValidationMessageFor(x => x.Location)
                </div>

                @if (Model.AmountOfPoints >= settings.PointsAllowedForExtendedProfile)
                {
                    <div class="form-group">
                        @Html.LabelFor(x => x.Website)
                        @Html.TextBoxFor(x => x.Website, new { @class = "form-control" })
                        @Html.ValidationMessageFor(x => x.Website)
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(x => x.Twitter)
                        @Html.TextBoxFor(x => x.Twitter, new { @class = "form-control" })
                        @Html.ValidationMessageFor(x => x.Twitter)
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(x => x.Facebook)
                        @Html.TextBoxFor(x => x.Facebook, new { @class = "form-control" })
                        @Html.ValidationMessageFor(x => x.Facebook)
                    </div>

                    if (settings.EnableSignatures)
                    {
                        <div class="form-group">
                            @Html.LabelFor(x => x.Signature)
                            @Html.TextAreaFor(x => x.Signature, new { @class = "form-control" })
                            @Html.ValidationMessageFor(x => x.Signature)
                        </div>
                    }
                }

                <div class="checkbox">
                    @using (Html.BeginLabelFor(m => m.DisableEmailNotifications, new {@class = "checkbox"}))
                    {
                        @Html.CheckBoxFor(m => m.DisableEmailNotifications)
                    }
                    @Html.ValidationMessageFor(m => m.DisableEmailNotifications)
                </div>

                <div class="submit-holder">
                    <button type="submit" class="btn-mvc-green btn-mvc-large">@Html.LanguageString("Buttons.Save")</button>
                </div>
            </fieldset>
        }

    </div>
</div>